#!/bin/bash

# 默认参数
TASK="h1"
RUN_NAME="default_run"
SIM_DEVICE="cuda:0"
RL_DEVICE="cuda:0"
HEADLESS=true

# 解析命令行参数
while [[ $# -gt 0 ]]; do
  case $1 in
    --task)
      TASK="$2"
      shift 2
      ;;
    --run_name)
      RUN_NAME="$2"
      shift 2
      ;;
    --sim_device)
      SIM_DEVICE="$2"
      shift 2
      ;;
    --rl_device)
      RL_DEVICE="$2"
      shift 2
      ;;
    --no-headless)
      HEADLESS=false
      shift
      ;;
    *)
      echo "未知参数: $1"
      exit 1
      ;;
  esac
done

# 构建命令
CMD="PYTHONPATH=/home/dm/ydw/humanplus/HST/legged_gym python legged_gym/scripts/train.py --task $TASK --run_name $RUN_NAME --sim_device $SIM_DEVICE --rl_device $RL_DEVICE"

if [ "$HEADLESS" = true ]; then
  CMD="$CMD --headless"
fi

# 执行命令
echo "执行命令: $CMD"
eval $CMD